<template>
  <div class="panel-data">
    <div class="content">
      <el-form
        ref="form"
        class="prop-form state-switching-unique"
        label-position="right"
        :model="form"
        :rules="rules"
        label-width="110px"
      >
        <panel-data
          ref="panelDataCommon"
          class="state-switching-unique"
          :config="config"
          :widgetInstanceId="widgetInstanceId"
          :dataSourceTypeOptions="dataSourceTypeOptions"
          :dataForm="form"
          :isAurora="isAurora"
          data-nameId="state-switching-unique"
        >
        </panel-data>
      </el-form>
    </div>
  </div>
</template>
<script>
import stateSwitchingBase from '@/mixin/panel-data-base.js';
import PanelData from '@/components/panel-data/panel-data-common.vue';
import orgConfig from './config';

export default {
  name: 'StateSwitchingPanelData',
  components: { PanelData },
  mixins: [stateSwitchingBase],
  props: ['dataSourceTypeOptions'],
  data() {
    let form;
    if (orgConfig) {
      // 规避本地环境报错
      form = JSON.parse(JSON.stringify(orgConfig.config.data));
    }
    if (this.config) {
      form = JSON.parse(JSON.stringify(this.config.config.data));
    }
    return {
      form,
    };
  },
};
</script>
